package db;
import java.sql.*;

/**
 * get a connection to the postgreSQL use method getConn();
 * this class also provide the connection information such
 * as URL, user name and password
 * @author Shi Mengjie
 * @version 1.0 
 */
public final class DBConn {
	Connection conn = null;
	String url="jdbc:postgresql:postgres";
	String userName="postgres";
	String pass="chlily";
	/**
	 * @return return a active Connection type
	 */
	public java.sql.Connection getConn(){
		try{
			Class.forName("org.postgresql.Driver").newInstance();
			conn = DriverManager.getConnection(url,userName,pass);
		}catch(Exception e){
			e.printStackTrace();
		}
		return this.conn;
	}
	/*only for debug
	public static void main(String args[]){
		DBConn bc = new DBConn();
		Connection con = bc.getConn();
		System.out.println(con.toString());
	}
	*/
}
